<?php
// 创建一个简单的脚本来测试position/all接口
$token = 'e60ea30bd0d377525f6751f5d1dc8bf49c8f678cb82d1ae0357a570ed187c336f673596b93207d039ea39ad521279fbb83af036cf97ecb925e5ac31bd24fd984c2258229a7cecd7d9f13ac003c30';

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'http://127.0.0.2/position/all',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer ' . $token
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #: " . $err;
} else {
  // 格式化输出JSON响应，便于阅读
  $decoded = json_decode($response, true);
  if ($decoded !== null) {
    echo json_encode($decoded, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
  } else {
    echo $response;
  }
}
?>